Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved Makefile. #436

Merged
merged 6 commits into from
Dec 26, 2024
Merged

Improved Makefile. #436

merged 6 commits into from
Dec 26, 2024

Conversation

alissa-huskey
Copy link
Contributor

I initially created this fork becaus when I ran make install the VERSION variable was not updated in todo.sh. So todo -V would produce:

TODO.TXT Command Line Interface v@DEV_VERSION@
...

But now I can't reproduce the problem. Shrug.

So instead: Here's a nicer Makefile if you want it!

Usage features:

  • Separate make build command that creates and populates the todo.txt_cli-*/ directory (and is in turn called by make dist.
  • A new make help command that lists all public targets.

Implementation changes:

  • VERSION-FILE is no longer generated every time make is run, only when required (by build/dist/clean etc, but test).
  • Refactored the dist target into separate file targets which is more atomic and make idiomatic. This may or may not be desirable as some people might find it confusing.
  • I added a bunch of missing .PHONY declarations.
  • Added lots of comments.

You can verify that the dist files are still generated correctly with the following:

mkdir -p tmp && cd tmp
git clone [email protected]:todotxt/todo.txt-cli.git todo
git clone --branch makefile [email protected]:alissa-huskey/todo.txt-cli.git todo-fork
mkdir dist dist-fork
make -C todo dist && make -C todo-fork dist
tar xzvf todo/*.tar.gz --directory ./dist && tar xzvf todo-fork/*.tar.gz --directory dist-fork

# confirm they contain the same files
diff <(ls dist/todo*/) <(ls dist-fork/todo*/)

# confirm the contents of all files are the same
for f in dist/todo*/*; do diff -w ${f} dist-fork/todo*/${f##*/} ; done

Hope you find it useful!

alissa-huskey and others added 6 commits December 26, 2024 11:04
The default shell (/bin/sh) might not understand the Bash syntax. This happens on Ubuntu 20.04; column produces garbled output then.
So far, the version file gets updated, which isn't a meaningful default action and rather incidental.
Defaulting to help output that lists all available targets is a much better default.
… closest tag only

No need to emulate the dirty addition any longer; Git has this built-in.
Use the full long version to avoid accidentally building packages that look like the released version, but contain further commits.
The official build should be done after tagging, on the tagged version commit.
This could be confusing, as there have been 2.1.0 and 2.3.0 releases.
Copy link
Member

@inkarkat inkarkat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me; I just did the 2.13.0 release, and the updated implementation would work as well.

@inkarkat inkarkat merged commit 639e574 into todotxt:master Dec 26, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants